const cloud = require('wx-server-sdk')
// var request = require('request')
var request = require('request-promise');
cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
    //qz
    return new Promise((resolve, reject) => {
        request({
            url: event.url,
            method: "post",
            json: true,
            form: {
              'username': 2020214371,
              'password': 'W2k9s3Co0%2Bc5sgK80AOISFRMGNwsH9fzT8S%2Fv79iJHcwLrxctLoa5EUAL3iCGV%2BkkiKXTJir4HMr%2FCJy2K1zlEsSiKcfUvP1bZ423%2BRy9c0%3D',
              'captcha': '',
              '_eventId': 'submit',
              'lt': '',
              'cllt': 'userNameLogin',
              'dllt': 'generalLogin',
 
            },
            headers: {
                "content-Type": "application/x-www-form-urlencoded",
               
            },
        }, function (error, response, body) {
            console.log("响应"+body)
            resolve(body)
            if (!error && response.statusCode == 200) {
                try {
                  return
                } catch (e) {
                    reject()
                }
            }
        })
    })
}